<template>
	<view class="container">
		<view class="index_bg">
			<!-- 内容 -->
			<view class="p-lr-16" style="padding-top: 340rpx;">
				<view class="uni-flex uni-row bg-white p-tb-12 radius-12"
					style="-webkit-flex-wrap: wrap;flex-wrap: wrap;">
					<view class="w-percentage-33 flex-x-center flex-y-center flex-direction-column p-tb-8"
						v-for="(item,index) in tab" :key="index" @click="toPage(item)">
						<image :src="item.icon" class="w-40 h-40"></image>
						<view>{{item.name}}</view>
					</view>
				</view>
			</view>
			<!-- 列表 -->
			<view class="p-16 pb-50">
				<view class="flex bg-white pr-12 mb-12" v-for="(item,index) in list" :key="index">
					<view>
						<image :src="$utils.getPic(item.coverImg)" style="width: 180rpx; height: 200rpx;"  class="radius-4">
						</image>
					</view>
					<view class="pl-8 p-tb-8">
						<view class="fs-16 fw-700">{{item.title}}</view>
						<view class="two-line-text-space cl-999 fs-14">{{item.content}}</view>
						<view class="flex-x-end fs-12 cl-999">{{item.createtime}}</view>
					</view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// tab数据
				tab: [{
					icon: "/static/image/index8.png",
					name: "展厅展览",
					url: '/pages/indexOther/showroom',
					type:0,
				}, {
					icon: "/static/image/index10.png",
					name: "馆藏文物",
					url: '/pages/indexOther/showroom',
					type:1,
				}, {
					icon: "/static/image/index11.png",
					name: "服务指南",
					url: '/pages/indexOther/server'
				}, {
					icon: "/static/image/index13.png",
					name: "活动讲座",
					url: '/pages/indexOther/showOrder',
					type:3,
				}, {
					icon: "/static/image/index12.png",
					name: "参观预约",
					url: '/pages/indexOther/showOrder',
					type:4,
				}],
				// list数据
				list: [],
				dataJson: {
					endtime: "",
					limit: 5,
					page: 1,
					search: "",
					starttime: "",
					type: 1,//文物
				}
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			getList() {
				
				this.$rqt.getMuseumPageList(this.dataJson).then((res) => {
					if (res.code == 200) {
						this.list = res.data.records
						uni.hideLoading()
					}
					uni.hideLoading()
				})
			},
			toPage(item) {
				if(item.name == '展厅展览' || item.name == '馆藏文物' ){
					uni.navigateTo({
						url: item.url+'?type='+item.type
					})
				}else{
					uni.navigateTo({
						url: item.url+'?type='+item.type
					})
				}
			}
		}
	}
</script>

<style>
	.index_bg {
		background: url('https://gitee.com/wangjingnlb/picture/raw/37113707afe495ab168a9a74ee2680fcb7db842f/bg.jpg') no-repeat;
		background-size: 100% 100%;
		height: 420rpx;
	}
	image {
	vertical-align: bottom;
	}
</style>